$(document).ready   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
dl 0
loc 8
rs 9.4285
nop 1
1
$(document).on('ready', function () {
2
3
    var scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
0 ignored issues
show
Bug introduced by
The variable Instascan seems to be never declared. If this is a global, consider adding a /** global: Instascan */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
    scanner.addListener('scan', function (content) {
5
        $('input[name="ticketId"]').val(content);
6
        $('#qr').hide();
7
        $('button[name="submit"]').click();
8
        scanner.stop();
9
    });
10
    Instascan.Camera.getCameras().then(function (cameras) {
0 ignored issues
show
Bug introduced by
The variable Instascan seems to be never declared. If this is a global, consider adding a /** global: Instascan */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
11
        if (cameras.length > 0) {
12
            scanner.start(cameras[0]);
13
            $('#qr').show();
14
        } else {
15
            console.error('No cameras found.');
16
        }
17
    }).catch(function (e) {
18
        console.error(e);
19
    });
20
21
});